package com.myiam.idm.core.service;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class PersistenceUtility {

	
    private EntityManagerFactory emf = null; 
    
    
    public EntityManager getEm() {
    	
    	try {
	    	if (emf == null) {
	    		emf = Persistence.createEntityManagerFactory("test");
	    	}
	    	return emf.createEntityManager();
	    	
    	} catch (Exception e ){
	    	System.out.println(e);
	    	e.printStackTrace();
	    	
	    }
    	return null;
    }
    
}
